package com.example.mybatisplus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.mybatisplus.entity.Emp;
import com.example.mybatisplus.mapper.EmpMapper;
import com.example.mybatisplus.service.EmpService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class EmpServiceImpl extends ServiceImpl<EmpMapper, Emp> implements EmpService {

    @Override
    public List<Emp> getAllEq(Map<String, Object> params) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.allEq(params);
        return list(wrapper);
    }

    @Override
    public List<Emp> getEq(String column, Object val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.eq(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getNe(String column, Object val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.ne(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getGt(String column, Object val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.gt(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getGe(String column, Object val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.ge(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getLt(String column, Object val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.lt(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getLe(String column, Object val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.le(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getBetween(String column, Object val1, Object val2) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.between(column, val1, val2);
        return list(wrapper);
    }

    @Override
    public List<Emp> getNotBetween(String column, Object val1, Object val2) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.notBetween(column, val1, val2);
        return list(wrapper);
    }

    @Override
    public List<Emp> getLike(String column, String val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.like(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getNotLike(String column, String val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.notLike(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getLikeLeft(String column, String val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.likeLeft(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getLikeRight(String column, String val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.likeRight(column, val);
        return list(wrapper);
    }

    @Override
    public List<Emp> getNotLikeLeft(String column, String val) {
        QueryWrapper<Emp> wrapper = new QueryWrapper<>();
        wrapper.notLikeLeft(column, val);
        return list(wrapper);
    }
}